/**
 * 
 */
package com.mperon.dao;

import java.io.Serializable;
import java.util.List;

/**
 * The Interface DAO.
 * 
 * @author marcos
 */
public interface DAO<C extends Serializable> {

    /**
     * Load.
     * 
     * @param id the id
     * 
     * @return the c
     */
    public C load(Serializable id);

    /**
     * Save.
     * 
     * @param obj the obj
     */
    public void save(C obj);

    /**
     * Count.
     * 
     * @return the int
     */
    public int count();

    /**
     * Delete.
     * 
     * @param obj the obj
     */
    public void delete(C obj);

    /**
     * List.
     * 
     * @return the list< c>
     */
    public List<C> list();

    /**
     * List.
     * 
     * @param start the start
     * @param qtd the qtd
     * 
     * @return the list< c>
     */
    public List<C> list(int start, int qtd);

    /**
     * Find by example.
     * 
     * @param ex the ex
     * 
     * @return the list< c>
     */
    public List<C> findByExample(C ex);

    /**
     * Find by example.
     * 
     * @param ex the ex
     * @param start the start
     * @param qtd the qtd
     * 
     * @return the list< c>
     */
    public List<C> findByExample(C ex, int start, int qtd);

    /**
     * New transaction.
     * 
     * @return the transaction
     */
    public Transaction newTransaction();

    /**
     * Transaction.
     * 
     * @param cmd the cmd
     * 
     * @return the object
     */
    public Object transaction(DAOCommand cmd);

    /**
     * Execute.
     * 
     * @param cmd the cmd
     * 
     * @return the object
     */
    public Object execute(DAOCommand cmd);
}
